﻿Public Class MatHangDAO
    Public Shared Function selectall() As DataTable
        Dim strsql As String
        strsql = "select * from MATHANG"
        Dim dt As DataTable
        dt = SQLProvider.ExecQuery(strsql)
        Return dt
    End Function
    Public Shared Sub insert(ByVal MH As MatHangDTO)
        Dim strsql As String
        strsql = "insert into MATHANG(MAMATHANG,TENMATHANG,DONGIABANSI,DONGIABANLE,MADONVITINH,SOLUONGTON,MANHACUNGCAP) Values('" & MH.MaMatHang & "','" & MH.TenMatHang & "'," & MH.DOnGiaSi & "," & MH.DonGiaLe & ",'" & MH.MaDonViTinh & "'," & MH.SoLuongTon & ",'" & MH.MaNhaCungCap & "')"
        SQLProvider.ExecNoneQuery(strsql)
    End Sub
    Public Shared Sub delete(ByVal mh As String)
        Dim strsql As String
        strsql = "delete MATHANG where MAMATHANG = '" & mh & "'"
        SQLProvider.ExecNoneQuery(strsql)
    End Sub
    Public Shared Sub Update(ByVal MH As MatHangDTO)
        Dim strSQL As String = "Update MATHANG set TENMATHANG = '" & MH.TenMatHang & "',MADONVITINH = '" & MH.MaDonViTinh & "',DONGIABANSI = " & MH.DOnGiaSi & ",DONGIABANLE = " & MH.DonGiaLe & ",SOLUONGTON = " & MH.SoLuongTon & ",MANHACUNGCAP = '" & MH.MaNhaCungCap & "' where MAMATHANG = '" & MH.MaMatHang & "'"
        SQLProvider.ExecNoneQuery(strSQL)
    End Sub
End Class
